#include "stdafx.h"
#include <boost/test/auto_unit_test.hpp>
#include "detail/bmock_raw_mem.hpp"
#include "bmock_in_out_raw_mem.hpp"
#include "bmock_util.hpp"

namespace bmock {
	static const int    IN_V  = 0x12345678;
	static const int    OUT_V = 0x89ABCDEF;
	static const size_t LEN1   = sizeof(int);
	static const unsigned char expected[] = {
		0x04,0x00,0x00,0x00
		,0x04,0x00,0x00,0x00
		,0x10,0x00,0x00,0x00
		,0x06,0x00,0x00,0x00
		,0x78,0x56,0x34,0x12
		,0xEF,0xCD,0xAB,0x89
	};
	static const size_t               LEN2        = sizeof(expected);
	static const int *const IN_V_BEGIN  = &IN_V;
	static const int *const IN_V_END    = IN_V_BEGIN + LEN1;
	static const int *const OUT_V_BEGIN = &OUT_V;
	static const int *const OUT_V_END   = OUT_V_BEGIN + LEN1;

	BOOST_AUTO_TEST_CASE(test_in_out_T_mem) {
		BOOST_CHECK_NO_THROW(
			in_out_raw_mem_descr<int>  rm = in_out_raw_mem(IN_V,OUT_V);
		const unsigned char *const ptr = reinterpret_cast<const unsigned char *>(rm.get_ptr());

		BOOST_CHECK_EQUAL(LEN2,mismatch_at(expected,expected+LEN2,ptr));
		);	
	}
}